package JavaCodePublicClass.龟兔赛跑;

public class Tortoise extends Animal {
    //知道这个动物是乌龟
    public Tortoise() {
        setName("乌龟");
    }

    public void runing() {
        //乌龟的速度
        int dis = 2;//乌龟每秒跑多少米
        lenght -= dis;
        System.out.println("乌龟跑了" + dis + "米.距离终点还有" + lenght + "米");
        if (lenght <= 0) {
            lenght = 0;
            System.out.println("乌龟胜利了!!!");
            if (calltoback != null) {
                calltoback.win();
            }
        }
        try {
            sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}